import { OpManufacturerIM, OpManufacturerPPM, OpManufacturerLRM } from '@/model/operations/manufacturer.model';
import { defHttp } from '@/utils/http/axios';

const basicApi = '/operations/admin/manufacturer';

enum Api {
  LIST = basicApi + '/list',
  GET = basicApi + '/',
  ADD = basicApi,
  EDIT = basicApi,
  EDIT_STATUS = basicApi + '/status',
  DEL_BATCH = basicApi + '/batch/',
}

/** 查询资产列表 */
export const listOpManufacturerApi = (params?: OpManufacturerPPM) =>
  defHttp.get<OpManufacturerLRM>({ url: Api.LIST, params });

/** 查询资产详细 */
export const getOpManufacturerApi = (id: string) =>
  defHttp.get<OpManufacturerIM>({ url: Api.GET, params: id });

/** 新增资产 */
export const addOpManufacturerApi = (params: OpManufacturerIM) =>
  defHttp.post({ url: Api.ADD, params });

/** 修改资产 */
export const editOpManufacturerApi = (params: OpManufacturerIM) =>
  defHttp.put({ url: Api.EDIT, params });

/** 修改资产状态 */
export const editStatusOpManufacturerApi = (id: string, status: string) =>
  defHttp.put({
    url: Api.EDIT_STATUS,
    params: { id: id, status: status },
  });

/** 删除资产 */
export const delOpManufacturerApi = (ids: string | string[]) =>
  defHttp.delete({ url: Api.DEL_BATCH, params: ids.toString() });
